import pickle
import time


def is_cookie_expired(cookie):
    # Get the cookie's expiry time
    expiry_time = cookie.get('expiry', None)
    if expiry_time is None:
        return False  # Cookie doesn't have an expiry time, so it's not expired

    # Convert expiry time to a Unix timestamp
    expiry_timestamp = int(expiry_time)

    # Get the current time
    current_timestamp = int(time.time())

    # Compare expiry time with current time
    return current_timestamp > expiry_timestamp


# Load cookies from file
with open('../cookies.pkl', 'rb') as f:
    cookies = pickle.load(f)

# Check if each cookie is expired
for cookie in cookies:
    if is_cookie_expired(cookie):
        print("Cookie is expired:", cookie)
    else:
        print("Cookie is not expired:", cookie)
